﻿%-*-coding: utf-8 -*- 
%lfsc.tex

\documentclass[UTF8,nofonts]{book}
\usepackage{ctex}

%\setCJKmainfont[ItalicFont={AR PL New Kai}]{AR PL New Sung}% 文鼎宋体和楷书
\setCJKmainfont[BoldFont={WenQuanYi Zen Hei}]{HAN NOM A}% 文鼎宋体和楷书
\setCJKsansfont[BoldFont={WenQuanYi Zen Hei}]{AR PL New Kai}% 文泉驿的黑体
\setCJKmonofont{WenQuanYi Zen Hei Mono}% 文泉驿等宽黑体 
%\setmainfont{DejaVu Serif} % 西文衬线字体 DejaVu 
%\setsansfont{DejaVu Sans} % 西文无衬线
%\setmonofont{DejaVu Sans Mono}
\setCJKfamilyfont{wqy}{WenQuanYi Zen Hei}
\setCJKfamilyfont{wqym}{WenQuanYi Zen Hei Mono}
%\newcommand*{\wqyz}{\CJKfamily{wqy}}

\usepackage{fancybox} %不同形式的盒子
\usepackage{fontspec}
\usepackage[usenames,svgnames]{xcolor} %颜色定义宏包
\pagestyle{headings} %定义页眉在页首
\usepackage[colorlinks]{hyperref} %定义链接格式，使用颜色，不使用方框
\usepackage{nameref} %用名字引用小节

\usepackage[hmargin=2.38cm]{geometry} %定义页边距
%\usepackage{fancyvrb} %增强的verbtaim环境
\usepackage{framed}
\usepackage{mdframed} %文本背景框
\usepackage{changepage}
\usepackage{graphicx} %插入图片
\usepackage{tikz} % 使用tikz绘图
\usepackage{bbding} % 处理各种符号
\usepackage{listings} %代码着色宏包
%\usepackage{minted} %代码高亮宏包
\usepackage{enumerate} % 列表定义宏包

\usepackage{datetime}  %处理时间和日期
%\usepackage{draftwatermark} % 水印

\usepackage{makeidx} % 索引文件
%\renewcommand\indexname{索~~引}
\def\generateindex{
   \addcontentsline{toc}{chapter}{\indexname}

   \printindex
   \cleardoublepage
}

%\usepackage{syntonly} %只执行检查，不编译
%\syntaxonly %only test
\usepackage{titlesec}
%\usepackage{calc}

%\usepackage{caption} % 设置标题格式
%\captionsetup{
%	justification=raggedright,
%	labelfont={color=Maroon,bf},
%	font=small}
%\usepackage{subfigure}
%\usepackage{url}

%\CTEXsetup[number={\arabic{chapter}}]{chapter} %让章标题为数字，而不是汉字
%\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}

%指定章节标题颜色
%\titleformat{\section}{\Large \bfseries \filright}{\thesection}{1em}{}

\lstset{
language=bash,
basicstyle=\ttfamily,
%commentstyle=\ttfamily,
backgroundcolor=\color{lightgray},
%nolol=false,
showspaces=false,
showstringspaces=false,
showtabs=false,
%captionpos=b,
breaklines=true,
numberbychapter=true,
escapeinside={(*@}{@*)}
}


%定义单个命令执行输入 onecmd，正文中有很多这种加粗的输入
\newcommand{\oc}[1]
{\texttt{\textbf{#1}}}

%定义输入命令环境
\lstnewenvironment{cmd}
{\lstset{basicstyle=\ttfamily\bfseries}}
{}

% 定义命令终端输出
\lstnewenvironment{cmdout}
{\lstset{basicstyle=\ttfamily}}
{}

\lstnewenvironment{goodboy}
{\lstset{basicstyle=\ttfamily}}
{}

\newcommand{\boybad}[3]
{
\begin{cmdout}
(*@\textbf{#1}@*)
{#2}
(*@\textbf{#3}@*)
\end{cmdout}
}

\newcommand{\emphi}[1]
{\emph{#1}}

\newcommand{\link}[1]
{\url{#1}}

\newcommand{\repl}[1]
{\texttt{\textit{#1}}}%

\newcommand{\opt}[1]
{\texttt{\textit{#1}}}%

\newcommand{\man}[1]
{\texttt{#1}}%

% the shaded outter frame
\newenvironment{outshaded}{%
  \def\FrameCommand{\colorbox{LightYellow}}%
  \MakeFramed {\FrameRestore}}%
 {\endMakeFramed}

% the hand pointing right, and the "Note" title 
\newcommand*\mysign{%
  \begin{tikzpicture}
    \node[circle,draw,inner sep=2pt] at (0,-0.2) {\HandRight} ;% the hand pointing
    \node at (1.3,-0.2) {\bfseries  提示};
  \end{tikzpicture}}

% this environment will be used to typeset the notes
\newenvironment{note}
  {\begin{outshaded}\mysign%
    \begin{adjustwidth}{2cm}{1cm}}
  {\end{adjustwidth}\end{outshaded}}
 
 %定义重要环境
 \newcommand*\mysignimp{%
  \begin{tikzpicture}
    \node[fill=LightSteelBlue!40,circle,draw,inner sep=2pt] at (0,-0.2) {\FourStar} ;% the hand pointing
    \node at (1.3,-0.2) {\bfseries 重要};
  \end{tikzpicture}}
  
\newenvironment{important}
  {\begin{outshaded}\mysignimp%
    \begin{adjustwidth}{2cm}{0cm}}
  {\end{adjustwidth}\end{outshaded}}
  
 %定义警告环境
 \newcommand*\mysigncaution{%
  \begin{tikzpicture}
    \node[circle,draw,inner sep=2pt] at (0,-0.2) {\HandRight} ;% the hand pointing
    \node at (1.3,-0.2) {\bfseries 警告};
  \end{tikzpicture}}
  
\newenvironment{caution}
  {\begin{outshaded}\mysigncaution%
    \begin{adjustwidth}{2cm}{0cm}}
  {\end{adjustwidth}\end{outshaded}}
 
% 定义mdframed环境
\newenvironment{mymdframed}
{\begin{mdframed}[skipabove=8pt,backgroundcolor=LightYellow]}
{\end{mdframed}}

% 定义提示框环境
\newcommand{\mynote}[2][注意]{
  	\begin{mymdframed}{
		\parbox[t]{0.1\textwidth}{\includegraphics[scale=0.5]{note.png}} \ 
		\parbox[t]{0.9\textwidth}{\textbf{#1} \\ {#2}}}
	\end{mymdframed}
}

%定义节引用
\newcommand{\secref}[1]{
\ref{#1}-\nameref{#1}
}

%定义编译时间和磁盘空间宏命令
\newcommand{\compcost}[2]{
\textbf{预估构建时间：{#1}} %

\textbf{磁盘需求：{#2}} %
}

\makeindex % 生成索引

\begin{document}
%\title{\Huge\CJKfamily{wqym}{\textbf{\texttt{Linux}}自由构建指南}}
%\author{Gerard Beekmans}

%\maketitle
%\tableofcontents
%\setcounter{tocdepth}{3} %设置目录深度
%\lstlistoflistings %示例列表


\frontmatter
%\include{preface}

\mainmatter
%\pagecolor{lightgray}
%\part{介绍}
%\include{c01-Introduction}

%\part{构建准备}
%\include{c02-Preparing_a_New_Partition}
%\include{c03-Packages and Patches}
%\include{c04-Final Preparations}
\include{c05-Constructing_a_Temporary_System}

%\part{构建LFS系统}

%Appendices
%\part{附录}

%\begin{thebibliography}{00}
%\bibitem{test} 测试
%\end{thebibliography}

\backmatter

%\include{index}
\end{document}
